﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using MatriculaLib.Repositorio;
using MatriculaLib.Basic;
using MatriculaLib.Regra;

namespace MatriculaService
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService
    {
        RegMatricula regras = new RegMatricula();
        [WebMethod]
        public List<string> serie()
        {
                return RepMatricula.getInstancia().serie();
        }

        [WebMethod]
        public List<string> turma()
        {
                return RepMatricula.getInstancia().turma();
        }

        [WebMethod]
        public List<string> turno(string turma)
        {
                return RepMatricula.getInstancia().turno(turma);
        }

        [WebMethod]
        public void matricula(Matricula matricula,string nome, string serie, string turma)
        {
            try
            {

                regras.branco(nome,serie,turma);
                RepMatricula.getInstancia().matricula(matricula);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        [WebMethod]
        public int codSerie(string serie)
        {
            return RepMatricula.getInstancia().codSerie(serie);
        }

        [WebMethod]
        public int codTurma(string turma)
        {
            return RepMatricula.getInstancia().codTurma(turma);
        }

        [WebMethod]
        public int matAluno(string aluno)
        {
            return RepMatricula.getInstancia().matAluno(aluno);
        }

        [WebMethod]
        public List<Aluno> PesquisarAluno(string nome, string matricula)
        {
            try
            {
                return RepMatricula.getInstancia().PesquisarAluno(nome, matricula);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        [WebMethod]
        public List<Responsavel> PesquisarResponsavel(int matricula)
        {
            try
            {
                return RepMatricula.getInstancia().pesquisarResponsavel(matricula);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        [WebMethod]
        public List<Matricula> PesquisarMatricula(int matricula)
        {
            try
            {
                return RepMatricula.getInstancia().PesquisarMatricula(matricula);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        [WebMethod]
        public void qtdAluno(Matricula obj)
        {
            try
            {
                //regras.qtdAluno(obj);
                RepMatricula.getInstancia().serie_turma(obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

    }
}